<?php
/**
* @package readerTemplate
* @author Jan Papousek
* @copyright Jan Papousek 2007
* @link http://ctenar.cz
*/
/**
* Tabulka s vyhledanymi knihami.
* @package readerTemplate
*/
class BookListSearch extends BookList {
	
	public function __construct($redirect = TRUE, $compact = FALSE) {
		$this->switcherRead = TRUE;
		$search = new Search("book",Page::get("searchWord"),Page::get("order"),Page::get("page"), $redirect);
		$this->data = $search->search("book",Page::get("searchWord"),Page::get("order"),Page::get("page"), $redirect);
		$orderWriter = "writerName";
		$orderBook = "title";
		$orderRating = "rating DESC";
		$orderRead = "countRead DESC";
		switch(Page::get("order")) {
			case "":
				$orderBook .= " DESC";
				break;
			case $orderBook:
				$orderBook .= " DESC";
				break;
			case $orderWriter:
				$orderWriter .= " DESC";
				break;
			case $orderRating:
				$orderRating = "rating";
				break;
			case $orderRead:
				$orderRead = "countRead";
				break;
		}
		
		if($compact == FALSE){
			$page = "search.php?";
		} else {
			$page = "book.php?action=searchBook&amp;";
		}
		
		$head[] = new A(Lng::BOOK_TITLE,$page."searchWord=".Page::get("searchWord")."&amp;column=".Page::get("column")."&amp;order=$orderBook",Lng::ORDER);
		$head[] = new A(Lng::WRITER,$page."searchWord=".Page::get("searchWord")."&amp;column=".Page::get("column")."&amp;order=$orderWriter",Lng::ORDER);
		if($compact != TRUE)	$head[] = new A(Lng::RATING,$page."searchWord=".Page::get("searchWord")."&amp;column=".Page::get("column")."&amp;order=$orderRating",Lng::ORDER);
		$head[] = new A(Lng::READ,$page."searchWord=".Page::get("searchWord")."&amp;column=".Page::get("column")."&amp;order=$orderRead",Lng::ORDER); 
			
		$this->setHead($head);
		parent::__construct($compact);		
	}
	
	
	
}
?>
